meta %>%
filter(su_blkgp == 1) %>%
select(varname, about) %>% as.list()
## $varname
## [1] "lowwage_jobs" "midwage_jobs"
## [3] "higwage_jobs" "alljobs"
## [5] "lowwage_p" "midwage_p"
## [7] "higwage_p" "White_workers"
## [9] "Black_workers" "AI_Na_workers"
## [11] "Asian_workers" "NaH_PI_workers"
## [13] "Multiracial_workers" "lessThanHS_jobs"
## [15] "HSnoCollege_jobs" "SomeColl_Associates_jobs"
## [17] "Bach_AdvDeg_jobs" "w_county"
## [19] "w_blkgroup" "countyName"
##
## $about
## [1] "Number of low-wage jobs in the su (earnings $1250/month or less)"
## [2] "Number of mid-wage jobs in the su (earnings $1251/month to $3333/month)"
## [3] "Number of high-wage jobs in the su (earnings greater than $3333/month)"
## [4] "Total number of jobs in the su"
## [5] "Number of low-wage jobs in the su divided by the total number of jobs in the su"
## [6] "Number of mid-wage jobs in the su divided by the total number of jobs in the su"
## [7] "Number of high-wage jobs in the su divided by the total number of jobs in the su"
## [8] "Number of White alone workers employed in the su"
## [9] "Number of Black alone workers employed in the su"
## [10] "Number of American Indian or Alaska Native alone workers employed in the su"
## [11] "Number of Asian alone workers employed in the su"
## [12] "Number of Native Hawaiian or Other Pacific Islander alone workers employed in the su"
## [13] "Number of workers employed in the su who identify as two or more race groups"
## [14] "Number of jobs for workers with less than a high school education"
## [15] "Number of jobs for workers with a high school education but no college"
## [16] "Number of jobs for workers with some college or an Associates degree"
## [17] "Number of jobs for workers with a Bachelor's or advanced degree"
## [18] "5-digit county code"
## [19] "12-digit census block group code"
## [20] "County name"
glimpse(lodes)
## Rows: 43
## Columns: 20
## $ w_blkgr <dbl> 510010901001, 510010901002, 510010901003, 510…
## $ lowwage_jobs <int> 253, 69, 100, 63, 49, 88, 277, 38, 8, 4, 32, …
## $ midwage_jobs <int> 181, 97, 60, 63, 86, 198, 1102, 30, 20, 6, 16…
## $ higwage_jobs <int> 66, 47, 13, 14, 44, 274, 933, 5, 17, 1, 7, 22…
## $ alljobs <int> 500, 213, 173, 140, 179, 560, 2312, 73, 45, 1…
## $ lowwage_p <dbl> 0.5060000, 0.3239437, 0.5780347, 0.4500000, 0…
## $ midwage_p <dbl> 0.3620000, 0.4553991, 0.3468208, 0.4500000, 0…
## $ higwage_p <dbl> 0.13200000, 0.22065728, 0.07514451, 0.1000000…
## $ White_workers <int> 418, 190, 124, 104, 117, 451, 1087, 51, 42, 8…
## $ Black_workers <int> 64, 19, 41, 31, 55, 83, 1142, 18, 3, 3, 18, 3…
## $ AI_Na_workers <int> 1, 0, 2, 0, 2, 2, 6, 0, 0, 0, 0, 0, 0, 2, 0, …
## $ Asian_workers <int> 13, 1, 5, 3, 3, 14, 43, 1, 0, 0, 1, 1, 9, 19,…
## $ NaH_PI_workers <int> 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ Multiracial_workers <int> 4, 3, 1, 2, 2, 10, 33, 3, 0, 0, 0, 0, 2, 9, 0…
## $ lessThanHS_jobs <int> 56, 35, 23, 24, 24, 60, 369, 9, 4, 5, 12, 24,…
## $ HSnoCollege_jobs <int> 143, 66, 50, 26, 47, 144, 546, 19, 17, 2, 18,…
## $ SomeColl_Associates_jobs <int> 105, 44, 35, 34, 40, 152, 539, 15, 10, 2, 13,…
## $ Bach_AdvDeg_jobs <int> 59, 25, 15, 14, 22, 114, 465, 7, 6, 1, 4, 10,…
## $ w_county <int> 51001, 51001, 51001, 51001, 51001, 51001, 510…
## $ countyName <chr> "Accomack", "Accomack", "Accomack", "Accomack…
lodes %>% select(lowwage_jobs:Bach_AdvDeg_jobs) %>%
select(where(~is.numeric(.x))) %>%
as.data.frame() %>%
stargazer(., type = "text", title = "Summary Statistics", digits = 2,
summary.stat = c("mean", "sd", "min", "median", "max"))
##
## Summary Statistics
## ==========================================================
## Statistic Mean St. Dev. Min Median Max
## ----------------------------------------------------------
## lowwage_jobs 96.63 96.42 4 67 413
## midwage_jobs 169.07 256.73 1 94 1,264
## higwage_jobs 107.86 195.16 1 44 933
## alljobs 373.56 516.96 8 213 2,312
## lowwage_p 0.33 0.13 0.12 0.30 0.62
## midwage_p 0.42 0.13 0.02 0.44 0.65
## higwage_p 0.25 0.13 0.05 0.23 0.71
## White_workers 230.88 271.07 5 129 1,278
## Black_workers 130.56 259.99 1 48 1,279
## AI_Na_workers 1.09 1.86 0 0 9
## Asian_workers 6.40 8.89 0 3 43
## NaH_PI_workers 0.23 0.48 0 0 2
## Multiracial_workers 4.40 6.52 0 2 33
## lessThanHS_jobs 51.28 80.06 0 28 392
## HSnoCollege_jobs 96.14 132.96 2 53 622
## SomeColl_Associates_jobs 89.00 123.15 1 40 539
## Bach_AdvDeg_jobs 63.47 103.03 1 25 491
## ----------------------------------------------------------
lodes %>% select(c(w_blkgr:alljobs)) %>%
pivot_longer(-w_blkgr, names_to = "measure", values_to = "value") %>%
ggplot(aes(x = value, fill = measure)) +
scale_fill_viridis(option = "plasma", discrete = TRUE, guide = FALSE) +
geom_histogram() +
facet_wrap(~measure, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
meta %>%
filter(varname %in% c("higwage_jobs", "lowwage_jobs", "midwage_jobs", "alljobs")) %>%
mutate(label = paste0(varname, ": ", about)) %>%
select(label) %>%
as.list()
$label [1] "lowwage_jobs: Number of low-wage jobs in the su (earnings $1250/month or less)"
[2] "midwage_jobs: Number of mid-wage jobs in the su (earnings $1251/month to $3333/month)" [3] "higwage_jobs: Number of high-wage jobs in the su (earnings greater than $3333/month)" [4] "alljobs: Total number of jobs in the su"
## [1] TRUE
pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_lodes$alljobs)
leaflet(eastern_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = eastern_lodes,
fillColor = ~pal(alljobs),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("GEOID: ", eastern_lodes$w_blkgr, "<br>",
"Number of jobs: ", eastern_lodes$alljobs, 2)) %>%
addLegend("bottomright", pal = pal, values = eastern_lodes$alljobs,
title = "Number of jobs", opacity = 0.7)
pal <- colorNumeric("BuPu", domain = eastern_lodes$lowwage_p)
leaflet(eastern_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = eastern_lodes,
fillColor = ~pal(lowwage_p),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("GEOID: ", eastern_lodes$w_blkgr, "<br>",
"Prop. low-wage jobs: ", round(eastern_lodes$lowwage_p, 2))) %>%
addLegend("bottomright", pal = pal, values = eastern_lodes$lowwage_p,
title = "Proportion of <br> low-wage jobs", opacity = 0.7)
# High wage jobs
pal <- colorNumeric("BuPu", domain = eastern_lodes$higwage_p)
leaflet(eastern_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = eastern_lodes,
fillColor = ~pal(higwage_p),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
smoothFactor = 0.3,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("GEOID: ", eastern_lodes$w_blkgr, "<br>",
"Prop. high-wage jobs: ", round(eastern_lodes$higwage_p, 2))) %>%
addLegend("bottomright", pal = pal, values = eastern_lodes$higwage_p,
title = "Proportion of <br> high-wage jobs", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_lodes$Bach_AdvDeg_jobs)
leaflet(eastern_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = eastern_lodes,
fillColor = ~pal(Bach_AdvDeg_jobs),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
smoothFactor = 0.3,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("GEOID: ", eastern_lodes$w_blkgr, "<br>",
"Number of jobs: ", eastern_lodes$Bach_AdvDeg_jobs)) %>%
addLegend("bottomright", pal = pal, values = eastern_lodes$Bach_AdvDeg_jobs,
title = "Number of jobs for <br> college-educated workers", opacity = 0.7)
pal <- colorNumeric("plasma", reverse = TRUE, domain = eastern_lodes$HSnoCollege_jobs)
leaflet(eastern_lodes) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = eastern_lodes,
fillColor = ~pal(HSnoCollege_jobs),
weight = 1,
opacity = 1,
color = "white",
fillOpacity = 0.6,
smoothFactor = 0.3,
highlight = highlightOptions(
weight = 1, fillOpacity = 0.8, bringToFront = T
),
popup = paste0("GEOID: ", eastern_lodes$w_blkgr, "<br>",
"Number of jobs: ", eastern_lodes$HSnoCollege_jobs)) %>%
addLegend("bottomright", pal = pal, values = eastern_lodes$HSnoCollege_jobs,
title = "Number of jobs for <br> high school-educated workers", opacity = 0.7)